// 导入 express
const express = require('express')
// 创建路由对象
const router = express.Router()

const userinfo_handler=require('../router_handler/userinfo.js')
const expressJoi=require('@escook/express-joi')

const {update_userinfo_schema,update_password_schema,update_avatar_schema} =require('../schema/user.js')

// 获取用户的基本信息
router.get('/userinfo', userinfo_handler.getUserInfo)

//更新用户的基本信息email，nickname，content
router.post('/userinfo', expressJoi(update_userinfo_schema),userinfo_handler.updateUserInfo)

//重置用户密码
router.post('/updatepwd',expressJoi(update_password_schema),userinfo_handler.updatePassword)
//注销
router.post('/signout',userinfo_handler.signOut)
//用户头像
router.post('/avatar',expressJoi(update_avatar_schema),userinfo_handler.updateAvatar)
// 向外共享路由对象
module.exports = router
